/*
 * GPSService.h
 *
 *  Created on: Aug 14, 2014
 *      Author: Cameron Karlsson
 *
 *  See the license file included with this source.
 */

#ifndef GPSSERVICE_H_
#define GPSSERVICE_H_

#include <string>
#include <chrono>
#include <functional>
#include <values.h>
//#include <nmeaparse/GPSFix.h>
#include <NMEA_PARSER/NMEAParser.h>
#include <NMEA_PARSER/Event.h>
#include "INS_STATUS.h"
#include "INSM2_Define.h"

namespace nmea {

class GPSService {
private:


    bool read_GPGGA	(const NMEASentence& nmea);
    bool read_GTIMU	(const NMEASentence& nmea);
    bool read_GPFPD	(const NMEASentence& nmea);
    bool read_NVSTD	(const NMEASentence& nmea);
    bool read_GPRMC	(const NMEASentence& nmea);
//  void read_PSRF150(const NMEASentence& nmea);
//	void read_GPGSA	(const NMEASentence& nmea);
//	void read_GPGSV	(const NMEASentence& nmea);
//	void read_GPVTG	(const NMEASentence& nmea);

public:
//	GPSFix fix;
    RTK_STATUS gps_;
    INS_STATUS imu_;
    INS_STATUS ins_;

	GPSService(NMEAParser& parser);
	virtual ~GPSService();

	Event<void(bool)> onLockStateChanged;		// user assignable handler, called whenever lock changes
	Event<void()> onUpdate;						// user assignable handler, called whenever fix changes

	void attachToParser(NMEAParser& parser);			// will attach to this parser's nmea sentence events
};


}

#endif /* GPSSERVICE_H_ */
